﻿using System;
using System.IO;
using System.Configuration;

namespace Flickr2Frame
{
    class PublicVariables
    {
        #region General constants and variables
        public const int frameDetectionTimeout = 10000;
        public const string flickr2FrameXmlName = "Flickr2Frame.xml";
        public const string tempDirName = "Flickr2Frame";
        public const string localAppDirName = "Flickr2Frame";
        public const string localAppXmlName = "Flickr2Frame.xml";
        public const int marqueeAnimationSpeed = 50;
        public const string setNamePrefix = "Flickr2Frame";
        public const string setNameDelimiter = "_";
        public const int overallTasks = 10;
        public const string additionalExceptionBlurb = "\r\rIf this problem persists, please email support@flickr2frame.com, including as many details as possible.";
        public const int photosPerPage = 500;

        public static int additionalTasks = 0;
        public static string tempDirPath = Path.Combine(Environment.ExpandEnvironmentVariables("%TEMP%"), PublicVariables.tempDirName);
        public static string localAppDirPath = Path.Combine(Environment.ExpandEnvironmentVariables("%LOCALAPPDATA%"), PublicVariables.localAppDirName);
        public static bool flushCache = false;
        #endregion

        #region Application configuration read from App.config
        public static bool autoStartUpdate = Convert.ToBoolean(ConfigurationManager.AppSettings["autoStartUpdate"]);
        public static bool autoNamePhotos = Convert.ToBoolean(ConfigurationManager.AppSettings["autoNamePhotos"]);
        public static string photoNamePrefix = ConfigurationManager.AppSettings["photoNamePrefix"];
        public static int photoNameSuffixDigits = Convert.ToInt32(ConfigurationManager.AppSettings["photoNameSuffixDigits"]);
        public static bool copyAllToRoot = Convert.ToBoolean(ConfigurationManager.AppSettings["copyAllToRoot"]);
        public static int leaveFreeOnFrame = Convert.ToInt32(ConfigurationManager.AppSettings["leaveFreeOnFrame"]);
        public static bool flickrNetCacheDisabled = Convert.ToBoolean(ConfigurationManager.AppSettings["flickrNetCacheDisabled"]);
        public static int flickrNetCacheSizeLimit = Convert.ToInt32(ConfigurationManager.AppSettings["flickrNetCacheSizeLimit"]);
        public static TimeSpan flickrNetCacheTimeoutSeconds = new TimeSpan(0, 0, Convert.ToInt32(ConfigurationManager.AppSettings["flickrNetCacheTimeoutSeconds"]));
        public static bool createStartMenuShortcut = Convert.ToBoolean(ConfigurationManager.AppSettings["createStartMenuShortcut"]);
        public static bool createDesktopShortcut = Convert.ToBoolean(ConfigurationManager.AppSettings["createDesktopShortcut"]);
        public static int latestPhotoCount = Convert.ToInt32(ConfigurationManager.AppSettings["latestPhotoCount"]);
        #endregion

        #region Frame configuration read from Flickr2Frame.xml
        public static string frameDriveLetter = null;
        public static SupportedFrames frameType = SupportedFrames.GenericUSB01;
        public static PhotoOrder photoOrder = PhotoOrder.Sequential;
        public static string flickrSetPrefix = null;
        public static string photoDirectory = null;
        public static PhotoSize photoDownloadSize;
        public static string flickrApiKey = null;
        public static string flickrSharedSecret = null;
        public static string flickrAuthenticationToken = null;
        public static string flickrUserId = null;
        #endregion

        #region Enums
        public enum SupportedFrames
        {
            GenericUSB01,
            Philips01,
            Philips02
        }

        public enum PhotoOrder
        {
            Sequential,
            Random
        }

        public enum PhotoSize
        {
            Small,
            Medium,
            Large,
            Original
        }
        #endregion
    }
}
